﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <link href="./Public/Admin/Css/public.css" rel="stylesheet" type="text/css"/>
    <script src="./Public/Admin/Js/jquery.js"></script>
    <title>用户管理</title>
    <script type="text/javascript">
        //定义JS跳转的函数
        function confirmDel(id) {
            //询问是否要删除
            if (window.confirm("你真的要删除吗？")) {
                $.get("?c=User&a=delete&id=" + id, (message) => {
                    $("#tipsMsg").html(message);
                    $("#showMessage").show(500);
                    setTimeout(() => {
                        $("#tipsMsg").hide(600);
                        window.location.href = "?c=User";
                    }, 1000)
                })
            }
        }
    </script>
</head>

<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" oncontextmenu="self.event.returnValue=false">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="border">
    <tr class="topbg">
        <td>用户管理</td>
    </tr>
    <tr class="tdbg">
        <td height="30">&nbsp;&nbsp;
            <a href="?c=User&a=index">管理首页</a>&nbsp;|&nbsp;
            <a href="?c=User&a=add">添加用户</a>
        </td>
    </tr>
</table>
<br/>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="border">
    <tr class="title">
        <td align="center">编号</td>
        <td align="center">用户名</td>
        <td align="center">真实姓名</td>
        <td align="center">联系电话</td>
        <td align="center">角色</td>
        <td align="center">最后登录IP</td>
        <td align="center">最后登录时间</td>
        <td align="center">登录总次数</td>
        <td align="center">账号状态</td>
        <td align="center">操作选项</td>
    </tr>
    <{foreach $users as $user}>
    <tr class="tdbg">
        <td align="center"><{$user.id}></td>
        <td align="center"><{$user.username}></td>
        <td align="center"><{$user.name}></td>
        <td align="center"><{$user.tel}></td>
        <td align="center">
            <{if $user.role}><font color='red'>超级管理员</font><{else}>普通管理员<{/if}>
        </td>
        <td align="center"><{$user.last_login_ip}></td>
        <td align="center"><{$user.addate|date_format:'%Y-%m-%d %H:%M:%S'}></td>
        <td align="center"><{$user.login_times}></td>
        <td align="center">
            <{if $user.status}>正常<{else}><font color='red'>关闭</font><{/if}>
        </td>
        <td align="center">
            <a href="?c=User&a=edit&id=<{$user.id}>">修改</a> |
            <a href="javascript:void(0)" onClick="confirmDel('<{$user.id}>')">删除</a>
        </td>
    </tr>
    <{/foreach}>
</table>
<!--  模态对话框-->
<div id="showMessage"><br>
    <div id="myToast">
        <div class="toast-header">
            <img src="./Public/Admin/Images/huaxin.png" alt="" width="30">
            <strong>提示</strong>
            <small>1分钟前</small>
            <button>&times;</button>
        </div>
        <div id="tipsMsg">
            注册成功！
        </div>
    </div>
</div>
<!--  模态对话框-->
</body>
</html>
